package com.hy.controller;

import com.hy.pojo.BigDep;
import com.hy.pojo.Hospital;
import com.hy.service.IBigDepService;
import com.hy.service.IHospitalService;
import com.hy.util.PageResult;
import com.hy.util.QueryPageBean;
import com.hy.util.QueryPageResult;
import com.hy.util.Result;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;


/**
 * 科室Controller
 * 
 * @author ruoyi
 * @date 2025-03-07
 */
@RestController
@RequestMapping("/dep")
public class BigDepController {
    @Autowired
    private IBigDepService bigDepService;

    /**
     * 查询科室列表
     */
    @PostMapping("/list")
    public QueryPageResult list(@RequestBody QueryPageBean queryPageBean) {
        return bigDepService.selectBigDepList(queryPageBean);

    }
    @RequestMapping("/findBigDeps")
    public Result findBigDeps(){
        List<BigDep> list = bigDepService.findBigDeps();
        return Result.success( "查询成功", list);
    }


    /**
     * 获取科室详细信息
     */
    @GetMapping(value = "/{id}")
    public Result getInfo(@PathVariable("id") Long id) {
        return Result.success(bigDepService.selectBigDepById(id));
    }

    /**
     * 新增科室
     */
    @PostMapping
    public Result add(@RequestBody BigDep bigDep) {
        return Result.success(bigDepService.insertBigDep(bigDep));
    }

    /**
     * 修改科室
     */
    @PutMapping
    public Result edit(@RequestBody BigDep bigDep) {
        return Result.success(bigDepService.updateBigDep(bigDep));
    }

    /**
     * 删除科室
     */
	@DeleteMapping("/{ids}")
    public Result remove(@PathVariable Long[] ids) {
        return Result.success(bigDepService.deleteBigDepByIds(ids));
    }

    @RequestMapping("/findDocByDepId")
    public QueryPageResult findDocByDepId(@RequestBody QueryPageBean queryPageBean){
        System.err.println(queryPageBean);
        return bigDepService.findDocByDepId(queryPageBean);
    }
}
